#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:7_grade_students.py
# author:张世航
# datetime:2024/10/31 19:23
# software: PyCharm
"""
this is function  description 
"""
# import module your need

# 7  随机生成20个学生的成绩; 判断这20个学生成绩的等级; 用函数来实现;
#     A---成绩>=90;
#     B-->成绩在 [80,90)
#     C-->成绩在 [70,80)
#     D-->成绩<70


import random

def grade_students():
    grades = [random.randint(0, 100) for _ in range(20)]
    grade_levels = []
    for grade in grades:
        if grade >= 90:
            grade_levels.append('A')
        elif grade >= 80:
            grade_levels.append('B')
        elif grade >= 70:
            grade_levels.append('C')
        else:
            grade_levels.append('D')
    return grades, grade_levels

# 生成并输出成绩和等级
grades, levels = grade_students()
print("学生成绩:", grades)
print("成绩等级:", levels)